<?php
	require_once(realpath(dirname(__FILE__)) . "/Baseobj.class.php");
	require_once(realpath(dirname(__FILE__)) . "/Caracdispdesc.class.php");
	require_once(realpath(dirname(__FILE__)) . "/Caracval.class.php");

	// Classe Activite

	// id --> identifiant activite
	// desc --> nom de l'activité

	class Caracdisp extends Baseobj{

		var $id;
		var $caracteristique;

		const TABLE="caracdisp";
		var $table=self::TABLE;

		var $bddvars = array("id", "caracteristique");

		function __construct($id = 0){
			parent::__construct();

			if($id > 0)
 			  $this->charger($id);
		}

		function charger($id){
			return $this->getVars("select * from $this->table where id=\"$id\"");

		}

		function delete($requete){
				$resul = mysql_query($requete);
				CacheBase::getCache()->reset_cache();
		}


		function supprimer(){

            if($this->id == "")
                    return 0;

			$caracdispdesc =  new Caracdispdesc();
			$caracdisp =  new Caracdisp();
			$caracval = new Caracval();

			$this->delete("delete from $caracdispdesc->table where caracdisp=\"$this->id\"");
			$this->delete("delete from $this->table where id=\"$this->id\"");
			$this->delete("delete from $caracval->table where caracdisp=\"$this->id\"");
			$this->delete("delete from $this->table where id=\"$this->id\"");

			CacheBase::getCache()->reset_cache();

			return 1;

		}

	}


?>